package com.drone.drone_server.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.drone.drone_server.dto.DroneRouteIdAndName;
import com.drone.drone_server.entity.DroneRoute;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

// 无人机路线DAO
public interface DroneRouteDao extends BaseMapper<DroneRoute> {

    @Select("SELECT * FROM drone_route WHERE route_name LIKE CONCAT('%', #{name}, '%')")
    List<DroneRoute> searchByName(@Param("name") String name);

    @Select("SELECT route_id as id, route_name as routeName FROM drone_route  WHERE is_active = TRUE")
    List<DroneRouteIdAndName> selectActiveIdNameList();

    @Select("SELECT * FROM drone_route WHERE is_active = TRUE")
    List<DroneRoute> selectAllActiveRoutes();


}
